<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<input type="text" placeholder="员工姓名" id="name_input">
<input type="text" placeholder="员工工资" id="salary_input">
<input type="text" placeholder="员工工作" id="job_input">
<input type="button" value="添加" onclick="f()">
<table border="1">
  <caption>员工列表</caption>
  <tr><th>姓名</th><th>工资</th><th>工作</th></tr>
</table>
<script>
    //得到页面中的三个文本框和表格
    let nameInput = document.querySelector("#name_input");
    let salaryInput = document.querySelector("#salary_input");
    let jobInput = document.querySelector("#job_input");
    let table = document.querySelector("table");
    function f() {
        //创建tr和3个td
        let tr = document.createElement("tr");
        let nameTd = document.createElement("td");
        let salaryTd = document.createElement("td");
        let jobTd = document.createElement("td");
        //设置td显示的文本内容
        nameTd.innerText = nameInput.value;
        salaryTd.innerText = salaryInput.value;
        jobTd.innerText = jobInput.value;
        //把td装进tr
        tr.append(nameTd,salaryTd,jobTd);
        //把tr装进table
        table.append(tr);
    }
</script>
</body>
</html>